<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        // var item=''
        // var items=[]
        // for(let i=0;i<8;i++){
        //     item+='2'
        //     items[i]=item
        // }
        // console.log(eval(items.join('+')))

        let firstStr=''
        let arr=[]

        for(let i=0;i<8;i++){
            firstStr=firstStr+'2'

            arr.push(firstStr)
        }
        let total=arr.reduce((prev,next)=>{
            return Number(prev)+Number(next)
        })

        console.log(total)
        // console.log(firstStr)

        //reduce
    </script>
</body>
</html>